Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify use of E_DIAL_REFUSED in autonat #430

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

achingbrain
Copy link
Member

Adds a paragraph detailing when E_DIAL_REFUSED should be sent as a DialResponse status as it's not mentioned in the current spec.

I think this is consistent with go-libp2p since libp2p/go-libp2p#1527

Adds a paragraph detailing when `E_DIAL_REFUSED` should be sent as
a `DialResponse` status as it's not mentioned in the current spec.

I think this is consistent with go-libp2p since libp2p/go-libp2p#1527
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. //CC @elenaf9 who has been looking into these in the past #411

If the receiver elects not to dial any addresses from the message - for example
because they are invalid, because they resolve to the same host as the receiver,
because they only include private addresses, because it does not support the
relevant transports, or because it has no capacity, is sends a `DialResponse`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
relevant transports, or because it has no capacity, is sends a `DialResponse`
relevant transports, or because it has no capacity, it sends a `DialResponse`

@mxinden
Copy link
Member

mxinden commented Jul 22, 2022

Thanks 🙏 @achingbrain!

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add that you can’t trust on your peer doing this correctly - the Go implementation has been sending the wrong error code for a long time (until Elena fixed it recently).

Comment on lines +82 to +83
because they are invalid, because they resolve to the same host as the receiver,
because they only include private addresses, because it does not support the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
because they are invalid, because they resolve to the same host as the receiver,
because they only include private addresses, because it does not support the
because they are invalid, because it does not support the

because they only include private addresses

In rust-libp2p we don't reject requests in this case. Directly after starting to listen, a peer won't know any of their external addresses and instead just their listening addresses (which are all private). The server still attempts to dial them, based on the address it observes this peer on, i.e. it replaces the IP of each address in the message with the observed IP. We do this anyway for DDoS protection (see vacp2p/nim-libp2p#739 (comment); @Tanguy suggested that we also add a section on for this, which imo would make sense).
Only if the observed address is private we may reject the peer (depending on whether this was set in our config or not).

because they resolve to the same host as the receiver

Again, because we replace the IP with the observed one at least in rust-libp2p we don't really handle this case.


Not sure how I think about having an exemplary list of rejection reasons. They seem rather go-lib2p2p specific right now. I'd propose to either properly specify in which cases a DialRequest shall be rejected, or keep it on a higher level to leave it up to the implementation (see suggestion).

If the receiver elects not to dial any addresses from the message - for example
because they are invalid, because they resolve to the same host as the receiver,
because they only include private addresses, because it does not support the
relevant transports, or because it has no capacity, is sends a `DialResponse`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
relevant transports, or because it has no capacity, is sends a `DialResponse`
relevant transports, or because it has no capacity, it SHOULD send a `DialResponse`

We should probably add that you can’t trust on your peer doing this correctly - the Go implementation has been sending the wrong error code for a long time (until Elena fixed it recently).

@marten-seemann What do you think about using the keyword SHOULD, in the sense that it is recommended but one can not trust that the other peer actually does it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, this is a MUST. You should be able to trust your peer's reporting here.

In practice you can't. But that's just because the Go implementation was just not compliant with the spec, which brought us to the mess we're in right now (one more reason for Autonat v2!). I suggest adding a note here that this was the case.

@BigLep
Copy link
Contributor

BigLep commented Jun 26, 2023

@achingbrain and @p-shahi : this has been open for a long time. What are the next steps to get this landed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

5 participants